<template>
    <view class="page">
        <UVParseTest v-if='showUVParseTest'></UVParseTest>
        <RichTextTest v-if="showRichTextTest"></RichTextTest>
        <view class="change-box">
            <button class="change-button" type="warn" @click="tapChange">切换</button>
            <button class="change-button" type="warn" @click="tapLogin">login</button>
        </view>
    </view>
</template>

<script>
    import UVParseTest from "./uvparse-test.vue";
    import RichTextTest from "./richtext-test.vue";
    export default {
        data: function() {
            return {
                type: "uvparse"
            }
        },
        components: {
            UVParseTest,
            RichTextTest
        },
        computed: {
            showUVParseTest: function() {
                return this.type == "uvparse";
            },
            showRichTextTest: function() {
                return this.type == "richText";
            }
        },
        onShow() {

        },
        methods: {
            tapChange() {
                this.type = this.type == "uvparse" ? "richText" : "uvparse"
            },
            tapLogin() {
                uni.navigateTo({
                    url: "/pages/login/login"
                })
            }
        }
    }
</script>

<style lang="scss" scoped>
    .page {
        position: relative;

        .change-box {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            display: flex;
            flex-direction: column;
            align-items: center;

            .change-button {
                width: 90%;
            }
        }
    }
</style>